import request from '@/config/axios'

export function useSchoolApi() {
    return {
        // 分页列表
        getSchoolPage: async (params: PageParam) => {
            return await request.get({url: '/yxt/school/page', params})
        },
        // 查询
        getSchool: async (id: number) => {
            return await request.get({url: '/yxt/school/get?id=' + id})
        },
        // 创建学校
        createSchool: (data: any) => {
            return request.post({url: '/yxt/school/create', data})
        },
        // 更新学校
        updateSchool: (data: any) => {
            return request.post({url: '/yxt/school/update', data})
        },
        // 删除学校
        deleteSchool: async (id: number) => {
            return await request.delete({url: '/yxt/school/delete?id=' + id})
        },
        // 下拉选项
        getMapData: async () => {
            return await request.get({url: '/yxt/school/get-map-data'})
        },
        // 获取学年范围
        getDateRange: async (id: number) => {
            return await request.get({url: '/yxt/school/config/date?schoolId=' + id})
        },
        // 下拉选项
        getSimpleList: async () => {
            return await request.get({url: '/yxt/school/get-simple-list'})
        },
        // 冻结/激活学校
        updateStatus: async (data: any) => {
            return await request.post({url: '/yxt/school/updateStatus', data})
        },
        // 查询学校硬件配置
        getSupplierConfig: async (id: number) => {
            return await request.get({url: '/yxt/school/supplier/config/get?id=' + id})
        },
        // 更新学校硬件配置
        updateSupplierConfig: async (data: any) => {
            return request.post({url: '/yxt/school/supplier/config/update', data})
        },
    }
}
